{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "mod = __import__('json')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'{\"a\": 1, \"b\": 2}'"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mod.dumps(dict(a=1,b=2))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'module'>\n",
      "True\n"
     ]
    }
   ],
   "source": [
    "# from t import A\n",
    "import t\n",
    "import importlib,importlib_metadata\n",
    "mod = importlib.import_module('t')\n",
    "print(type(mod))\n",
    "print(t is mod)\n",
    "# mod.A().__dict__"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 't2.t3.t.A'> A {'b': 3}\n",
      "True\n"
     ]
    }
   ],
   "source": [
    "import importlib\n",
    "import t2.t3.t as mod1\n",
    "mod2 = importlib.import_module('.t','t2.t3')\n",
    "a = getattr(mod1, 'A')\n",
    "print(a, type(a()).__name__, a().__dict__)\n",
    "print(mod1 is mod2)\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1, 2, 3]\n",
      "['a', 'b', 'c']\n"
     ]
    }
   ],
   "source": [
    "class A:\n",
    "    a = [1,2,3]\n",
    "\n",
    "    def print_a(self):\n",
    "        print(self.a)\n",
    "\n",
    "class B(A):\n",
    "    a = ['a','b','c']\n",
    "\n",
    "\n",
    "A().print_a()\n",
    "B().print_a()"
   ]
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "c02958781b742ae52d0d8287b3a0f2585aef91d7347f52aab675ef95597e49ec"
  },
  "kernelspec": {
   "display_name": "Python 3.9.7 ('vs-flask')",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
